package controller;

import com.alibaba.fastjson.JSON;
import model.dto.ScheduleDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.ScheduleService;

import java.util.List;


/**
 * @className: controller.ScheduleController
 * @author: Xia
 * @create: 2023-03-15 14:08
 */
@Controller
@RequestMapping("/api/schedule/")
public class ScheduleController {
    @Autowired
    private ScheduleService service;
    @RequestMapping("scheduleList")
    public String toScheduleList(){
        return "scheduleList";
    }

    @ResponseBody
    @RequestMapping("getDoctorList")
    public String getSchedule(Long departmentId, Integer sign){
        List<ScheduleDto> schedule = service.getSchedule(departmentId, sign);
        return JSON.toJSONString(schedule);
    }
}
